1. Field of the Invention
The present invention relates generally to a controller area network and, more particularly, to a method and apparatus for padding a data frame with data using the data length code of a controller area network message.
2. Description of the Related Art
In the case where automobile electronic components are managed using an existing analog control method, bundles of electrical wires used for optional vehicle components, such as an AV system and a navigation system, are disposed in a vehicle in a disorderly fashion. Such bundles of thick electrical wires are a main cause of an increase in the weight of the vehicle and trouble with the electronic system of the vehicle.
Currently, it is necessary to make on-board electronic control devices, such as an engine management Electronic Control Unit (ECU), a transmission ECU, a ABS system and an air-bag system, which are provided in an automobile, to be able to share information and an increasing number of vehicle sensors therebetween, to provide a communication method that is robust to a noisy vehicle environment, and to connect the ECUs, having independent characteristics via a network.
A Controller Area Network (CAN) is a vehicle network system developed by Bosch Co. in Germany in order to solve the problem with vehicle wiring, which is becoming more and more complicated as time goes by, and functions to exchange information between on-board electronic control devices, which are responsible for an engine management device, a transmission device, and vehicle body electronic devices related to a breaking system, an airbag, an instrument cluster, lamps, and an air conditioner, which are provided in the vehicle.
Peripheral devices provided in the vehicle are connected to a single network (CAN) and exchange data in a serial communication manner, so that they are robust to harsh environmental factors, such as heat and noise, can attain a fast data transmission rate of 1 Mbit/s at a maximum, and can improve data reliability through error processing.
FIG. 1 is a diagram showing the structure of a CAN message that is defined in the current CAN standard. As shown in FIG. 1, the CAN message includes an 11 or 29-bit CAN Identifier (ID)/priority, a 4-bit Data Length Code (DLC), and an 8-byte data frame.
FIG. 2 is a diagram showing a data length code field in the CAN message that is defined in the current CAN standard, and shows the relationship between the length of data, which is included in the data frame of the CAN message, and data length code values. In FIG. 2, the data length code uses a 4-bit code value to represent the number of bytes of data that will be included in the data frame area of a maximum of 8 bytes.
The length of data transmitted via the CAN message depends on the value of the data length code field. In this case, the maximum number of bytes of data that can be included in the data frame of the CAN message is 8 bytes, so that values within the range from b0000(0) to b1000(8) are used for the data length code. For example, when the value of the data length code field is b0010(2), the length of data in the CAN message is 2 bytes.
However, the length of data in the CAN message can be represented by various numbers of bytes ranging from 0 to 8 bytes, so that consistent transmission time cannot be ensured at the time of transmission of data, and a reception side cannot predict the length of data to be transmitted. Therefore a problem occurs in that data processing efficiency is low at transmitting and receiving ends.